from sqlalchemy import Column, ForeignKey, UniqueConstraint
from sqlalchemy_utils import UUIDType

from server.framework.core.models import CoreModel


class IdeStackLink(CoreModel):
    __tablename__ = "ide_stack_link"
    ide_id = Column(UUIDType(binary=False), ForeignKey('ide.id', ondelete='cascade'))
    ide_stack_id = Column(UUIDType(binary=False), ForeignKey('ide_stack.id', ondelete='cascade'))

    __table_args__ = (UniqueConstraint('ide_id', 'ide_stack_id', name='uk_ide_stack_link'),)
